﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XNA_TD.Menue;

namespace XNA_TD
{
    public class Base : GameObject
    {
        static Matrix[] boneTransforms;

        public Base()
            : base(Priority.Tower, new Vector3(map.end.X - 1, terrain.getHeight(map.end.X - 1, map.end.Y), map.end.Y), GegnerTyp.Boden, "Tower/Base")
        {
            boneTransforms = new Matrix[model.Bones.Count];
            baseTower = this;
            lvlInfo = new LvlInfo("", 0, 0, 0, 100, 0, GegnerTyp.Nichts);
            ResetHealth();
        }

        protected override void Shot()
        {
        }

        public override void FixedGameUpdate()
        {
            health = Math.Min(lvlInfo.maxHealth, health + .0001f);
        }

        protected override Matrix[] CalculateAbsoluteBoneTransforms()
        {
            model.Root.Transform = root * Matrix.CreateTranslation(position);
            model.CopyAbsoluteBoneTransformsTo(boneTransforms);

            return boneTransforms;
        }

        public override void Destroyed()
        {
 	            base.Destroyed();
                UnRegister(this);
                new VerlorenMenue();
        }
    }
}
